//
//  AccountMessageViewController.m
//  SchoolProduct
//
//  Created by 蒋松涵 on 16/9/5.
//  Copyright © 2016年 sm. All rights reserved.
//

#import "AccountMessageViewController.h"
#import "ReplacePhoneViewController.h"
#import "EmailViewController.h"

@interface AccountMessageViewController ()<UITableViewDataSource,UITableViewDelegate>


@property(nonatomic,strong)UITableView * tableView;


@end

@implementation AccountMessageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    self.title = @"账号信息";
    
    [self init_TableView];
    
}


#pragma mark - TableView
-(void)init_TableView
{
    self.tableView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    //去掉多余的表（线）
    self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
    //禁止滑动
    self.tableView.scrollEnabled = NO;
    [self.view addSubview:self.tableView];
    
}

#pragma mark - TableViewDataSource--------
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 3;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    //    CGFloat h = 736 / ScreenHeight;
    CGFloat w = 414 / ScreenWidth;
    
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell)
    {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    
    if (indexPath.row == 0)
    {
        cell.textLabel.text = @"更换手机号";
        cell.textLabel.font = [UIFont systemFontOfSize:17/w];
    }
    else if (indexPath.row == 1)
    {
        cell.textLabel.text = @"更换邮箱";
        cell.textLabel.font = [UIFont systemFontOfSize:17/w];
    }
    else
    {
        cell.textLabel.text = @"更改密码";
        cell.textLabel.font = [UIFont systemFontOfSize:17/w];
    }
    
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0)
    {
        //更换手机号
        self.hidesBottomBarWhenPushed = YES;
        ReplacePhoneViewController * ReplaceVC = [[ReplacePhoneViewController alloc]init];
        [self.navigationController pushViewController:ReplaceVC animated:YES];
    }
    else if (indexPath.row == 1)
    {
        //更换邮箱
        EmailViewController * emailVC = [[EmailViewController alloc]init];
        [self.navigationController pushViewController:emailVC animated:NO];
    }
    else
    {
        //更改密码
    }

}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
